package com.gitee.vueantd.common.utils.download;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
public class HttpFileInfo {
  private long startPos = 0;
  private long endPos = 0;
  private String fileName;

  public HttpFileInfo(long length, String fileName) {
    if (length > 0) {
      endPos = length - 1;
    }
    this.fileName = fileName;
  }

  public long getLength() {
    if (endPos > 0) {
      return endPos - startPos + 1; // use http mode to get length
    }
    return 0;
  }
}
